//
//  RowLabelCell.m
//  
//  jhf
//
//  Created by 计海峰 on 2020/7/22.
//  Copyright © 2020 jhfappkf@163.com. All rights reserved.
//

#import "RowLabelCell.h"
#import "RowTitleBaseM.h"

@implementation RowLabelCell

- (void)setup {
    [self.bgV addSubview:self.titleLB];
    [self.titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.bgV).offset(15);
        make.right.equalTo(self.bgV).offset(-15);
        make.top.equalTo(self.bgV).offset(15);
        make.bottom.equalTo(self.bgV).offset(-15);
    }];
}

- (void)bindTo:(__kindof id<BindProtocol>)model; {
    [super bindTo:model];
    BindModel *bind = (BindModel *)model;
    RowTitleBaseM *config = bind.model;
    [config.titleLBControl controlLB:self.titleLB];
    if (config.titleLBControl.vTopCons) {
        [self.titleLB mas_updateConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.bgV).offset(config.titleLBControl.vTopCons);
        }];
    }
    if (config.titleLBControl.vLeftCons) {
        [self.titleLB mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bgV).offset(config.titleLBControl.vLeftCons);
        }];
    }
    if (config.titleLBControl.vBottomCons) {
        [self.titleLB mas_updateConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.bgV).offset(-config.titleLBControl.vBottomCons);
        }];
    }
    if (config.titleLBControl.vRightCons) {
        [self.titleLB mas_updateConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.bgV).offset(-config.titleLBControl.vRightCons);
        }];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (UILabel *)titleLB {
    if (!_titleLB) {
        _titleLB = [UILabel new];
    }
    return _titleLB;
}

@end
